package com.lz.demo7;

/**
 * @ClassName TestCat
 * @Description 测试
 * @Author 2214361854
 * @Date 2022/5/28 14:50
 * @Version 1.0
 */
public class TestCat {
    public static void main(String[] args) {
        //6.1使用无参构造创建对象
        Cat c1 = new Cat();
        //6.2通过set()给对象的属性赋值
        c1.setName("叮当");
        c1.setAge(300);
        c1.setHost("大雄");
        c1.setKind("机器猫");
        c1.setPrice(10000);
        //6.3通过get()查看对象的属性值
        System.out.println(c1.getName());
        System.out.println(c1.getHost());
        System.out.println(c1.getAge());
        System.out.println(c1.getPrice());
        System.out.println(c1.getKind());

        //7.1使用全参构造创建对象,并同时给对象的所有属性赋值
        Cat c2 = new Cat("罗小黑", 7, "变异猫", "未知", 800);
        //7.2查看对象的赋值是否成功
        System.out.println(c2.getName());
        System.out.println(c2.getHost());
        System.out.println(c2.getAge());
        System.out.println(c2.getPrice());
        System.out.println(c2.getKind());

        //8.1创建小猫类的对象
        Cat c3 = new Cat();
        //8.2通过创建好的小猫对象调用小猫类的功能
        c3.eat(8);
        c3.sleep("罗小白", 9.9);
        c3.jump("花花");
        c3.play("苏大强");//只调用玩的功能,不接收返回值
        String n = c3.play("哈哈哈");//再次调用play(),选择接收返回值
        System.out.println(n);//把接到的玩具"逗猫棒"打印出来
    }
}
